-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent qtconsole frontend freeze on lots of output. #3409
Prevent qtconsole frontend freeze on lots of output. #3409
Conversation
I have tested this and it works well. The code also looks good. But I wouldn't mind someone else having a look as I know relatively little about Qt. |
Thanks a lot for tackling this one, it's been bugging me for some time. This is a very good start but with the current
From the user perspective, all these things would suggest that the console froze (although now it's not the case). Right now I'm trying to come up with a solution to improve this situation. |
@ccordoba12 This is very responsive on my machine, without much perceptible delay. I had actually written a very elaborate timer based mechanism to display output, but ended up with this as it very well for me with much simpler code too. |
@pankajp: I'm on Kubuntu 13.04, with an ATI Wrestler (Radeon 6320) card and an AMD E-450 processor of two cores. This is not a powerful machine, just a netbook. What do you see if you increase So if the text could be broken up and inserted in chunks of, say, |
@pankajp: I was wrong: printing But that seems to be a too small size. What if |
@ccordoba12 I like the idea of automatically reducing the buffer_size, but it needs more bookkeeping to revert it to original setting after execution is completed, keeping the previous output. |
@pankajp I just tested your timer branch and qtconsole is working the same as with my suggestion of reducing I think this will deal much better with the case of varying response times per computer architecture and output size. |
If this gets a rebase, I think we can merge soon. |
The output from the kernel is now clipped to last `buffer_size` before displaying and a timer is used to flush the pending output text instead of attempting to display text on every stream output from kernel. The timer interval is adjusted based on actual time taken to append a screenful of text to widget. This throttles the widget repaints and avoids choking the Qt event loop leaving time to handle other Qt events. Test cases: In [1]: for i in xrange(1000000): print i In [2]: range(100000) Without this commit the first input causes the qtconsole frontend to freeze, not responding to `Ctrl+C`.
@ccordoba12 Thanks for testing, I have moved the timer based approach here, and rebased on top of ipython master. |
A big +1 from me. @minrk it's very important for us at Spyder (and I imagine Enthought guys too) to have this in 1.0, because right now long or infinite |
thanks, will give it a look over and hopefully merge later today. |
Works in my tests. I'll defer to @ccordoba12 as you guys use the QtConsole much more aggressively than most. Merging. |
Prevent qtconsole frontend freeze on lots of output. The output from the kernel is now clipped to last buffer_size before displaying and a timer is used to flush the pending output text instead of attempting to display text on every stream output from kernel. The timer interval is adjusted based on actual time taken to append a screenful of text to widget. This throttles the widget repaints and avoids choking the Qt event loop leaving time to handle other Qt events.
Thanks! |
…put-clip Prevent qtconsole frontend freeze on lots of output. The output from the kernel is now clipped to last buffer_size before displaying and a timer is used to flush the pending output text instead of attempting to display text on every stream output from kernel. The timer interval is adjusted based on actual time taken to append a screenful of text to widget. This throttles the widget repaints and avoids choking the Qt event loop leaving time to handle other Qt events.
The output from the kernel is now clipped to last
buffer_size
before displaying and a timer is used to flush the pending output
text instead of attempting to display text on every stream
output from kernel. The timer interval is adjusted based on
actual time taken to append a screenful of text to widget.
This throttles the widget repaints and avoids choking the Qt
event loop leaving time to handle other Qt events.
Test cases:
In [1]: for i in xrange(1000000): print i
In [2]: range(100000)
Without this commit the first input causes the qtconsole frontend
to freeze, not responding to
Ctrl+C
.